package day9;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;

public class Jpaneldemo extends JPanel {
    BufferedImage bf;
    {
        try {
            bf=ImageIO.read( Jpaneldemo.class.getResourceAsStream("pic/background.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void paint(Graphics g) {

        super.paint(g);
        g.drawImage(bf,0,0,this);
        Color c=new Color(200,100,50);
        g.setColor(c);
        Font font=new Font("黑体",Font.ITALIC,30);
        g.setFont(font);
        g.drawString("分数",20,50);
        SmallPlane sm=new SmallPlane();
        BigPlane bigPlane=new BigPlane();
        g.drawImage(bigPlane.bf, bigPlane.x, bigPlane.y, this);
        g.drawImage(sm.bf, sm.x, sm.y, this);
    }
}
